home *** CD-ROM | disk | FTP | other *** search
- #Most comments from ULP2.asm and ULP3.asm apply here as well.
-
-
-
- .global @__UseLibP4
- .text
- .sdreg r2
- .global _UseLibP4
- .align 4
- _UseLibP4:
- mflr r11
- stw r11,8(r1) #Save return address
- stwu r1,-96(r1) #Save stack pointer
- fmr f16,f1 #Transfer yrel from f1 to f16
- lwz r24,_MaxCnt(r2) #MaxCnt in r24.
- lwz r25,_LPixelBuf(r2) #Get Location of LPixelBuf
- lwz r27,_ColorTable32(r2) #Start of color table
- lwz r28,_BPP(r2) #Number bytes per pixel
- lfd f25,_Factor(r2) #Get Factor into f25
- lfd f22,_Two(r2) #Get Two into f22 as constant
- lfd f23,_Limit(r2) #Get Limit into f23 as constant
- fadd f14,f22,f22 #f14 is 4.
- # fadd f14,f14,f22 #f14 is 6.
- # fdiv f14,f14,f22 #f14 is 3.
-
- # f14 is 3.0
-
- # Use f27 as intermediate value in calculation of Zr4.
-
- #The above could have been done with a global definition of 3.000.
-
- fsub f15,f22,f22 #(float)xtemp = 0.
- lfd f10,_XCenter(r2)#f10 = XCenter
- li r30,0 #xtemp = 0.
- fsub f15,f15,f10 #xRel = xRel - XCenter
- fdiv f18,f15,f25 #xRel = xRel/Factor
-
- lfd f21,_DX(r2) #Get the real value of Delta x.
- lwz r29,_RightEdge(r2)
- # fmr f17,f16
- Start:
- fmr f15,f18 #Initial value of Zr is xRel
-
- # The following line was moved before rather than after fmr f17,f16
- # to give the fpu a break.
- li r23,1 #Initialize CurCnt = 1
- fmr f17,f16 #yRel into f17 as initial Zi.
- b l3 #Check to see if to MaxCnt
- l2:
- fmul f24,f15,f15 #Zr2 in f24
- fmul f4,f17,f17 #Zi2 = Zi*Zi
- fadd f19,f24,f4 #Zr2 + Zi2 -> f19
- fcmpu cr0,f19,f23 #Compare with Limit in f23.
- ble cr0,l6
-
- #The following section is not very time-critical as it is only reached once.
- #for each pixel
- cmpwi cr0,r28,2 #See if BPP < 2
- blt cr0,l8
- l7:
- slwi r10,r23,2 #4 times CurCnt for offset in ColorTable32
- add r26,r27,r10 #Find location of pixel color in ColorTable32
- lwz r11,0(r26) #Get ARGB from ColorTable
- stw r11,0(r25) #Store color in LPixelBuf
- addi r25,r25,4 #Point to next location in LPixelBuf
- b l1
- l8: andi. r3,r23,65535 #Color into r3 as UWORD for PlotIt
- bl _PlotIt
- l9: b l1
- l6:
- fmul f20,f24,f14 #Find 4*Zr2
-
- fsub f27,f24,f4 #Find Zr2 - Zi2 ***
-
- fmul f20,f20,f4 #Now have 4*Zr2*Zi2
-
- fmul f28,f27,f27 #Square above
- fmul f27,f27,f14 #4*(Zr2 - Zi2)
- fsub f28,f28,f20 #Now have (Zr2-Zi2)^2 -4*Zr2*Zi2->Zr2 as f28.
-
- fmul f27,f27,f17 #4*(Zr2 - Zi2)*Zi
- addi r23,r23,1 #Increment CurCnt
- fmul f17,f27,f15 #4*(Zr2 - Zi2)*Zi*Zr -> Zi
-
- fadd f15,f18,f28 #New Zr = xRel + Zr2
- fadd f17,f16,f17 #Zi = Zi + yRel
-
- l3:
- cmpw cr0,r23,r24 #See if CurCnt < MaxCnt
- blt cr0,l2 #Repeat until MaxCnt reached
-
- cmpwi cr0,r28,2 #See if BPP < 2
- blt cr0,l11
- l10:
-
- lis r12,4
- addi r12,r12,-4
- add r26,r27,r12 #Find location of pixel color
- lwz r11,0(r26) #Get color
-
- stw r11,0(r25) #Store color in LPixelBuf
- addi r25,r25,4 #Point to next pixel in buffer
- b l1 #Was l12
- l11:
- lis r11,1
- addi r3,r11,-1 #ffff into r3 for PlotIt
- bl _PlotIt
- l1:
- fadd f18,f18,f21 #Find new value of xRel (xRel = xRel + DX).
- addi r30,r30,1 #Increment xtemp.
- cmpw cr0,r30,r29 #See if to RightEdge
-
- blt cr0,Start #Repeat until row is done.
- stw r25,_LPixelBuf(r2) #New location in long pixel buffer
- addi r1,r1,96 #Balance Stack pointer
- lwz r11,8(r1) #Get return address
- mtlr r11
- fmr f1,f20
-
- blr
- .type _UseLibP4,@function
- .size _UseLibP4,$-_UseLibP4
-
- .global _MaxCnt
- .global _RightEdge
- .global _XCenter
- .global _Factor
- .global _Limit
- .global _Two
- # .global _Three
- .global _LPixelBuf
- .global _ColorTable32
- .global _BPP
- .global _DX
- .global _PlotIt
- .global @__PlotIt
-
- # .tocd
- # .align 3
- #l13:
- # .long 0x43300000,0x80000000
- #l14: .word 0
- #l15: .word 0